//
//  NSMutableArray+Base.m
//  Masonry
//
//  Created by Sings on 2019/7/15.
//

#import "NSMutableArray+Base.h"

@implementation NSMutableArray (Base)

- (NSArray<UITableViewRowAction *> *)tableCellAction {
    NSMutableArray *arr = [NSMutableArray array];
    for (BaseTableViewRowActionModel *actionModel in self) {
        UITableViewRowAction *action =
        [UITableViewRowAction rowActionWithStyle:actionModel.type
                                           title:actionModel.title
                                         handler:^(UITableViewRowAction *_Nonnull action,
                                                   NSIndexPath *_Nonnull indexPath) {
                                             if (actionModel.atcionClick) {
                                                 actionModel.atcionClick(indexPath);
                                             }
                                         }];
        action.backgroundColor = actionModel.bColor;
        [arr addObject:action];
    }
    return [NSArray arrayWithArray:arr];
}

@end
